ALTER PROCEDURE [dbo].[SP_SET_NGUOI_DAI_DIEN_BY_ID] 
	@ID INT,
    @USR_ID INT, 
    @INVOICE_ID INT
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	UPDATE 
	KHACH_THUE
	SET LEVEL = 2,  
		UPDATE_BY = @USR_ID,  
		UPDATE_AT = GETDATE()
	WHERE 
		ID <> @ID AND ACTIVE = 'A'
		
	UPDATE KHACH_THUE
	SET
		LEVEL = 1,  
		UPDATE_BY = @USR_ID,  
		UPDATE_AT = GETDATE()
	WHERE 
		ID = @ID
END
